﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class UserControls_adminHeader : System.Web.UI.UserControl
{

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            MembershipUser user = Membership.GetUser();

            AdminLink.NavigateUrl = "/admin/default.aspx";
            if (!Page.User.IsInRole("SueetieAdministrator"))
            {
                AdminLI.Visible = false;
                AdminLink.Visible = false;
            }
            UserLink.Text = "Welcome, Guest!";
            UserLink.NavigateUrl = "/members/login.aspx";
            if (Page.User.Identity.IsAuthenticated)
            {
                UserLink.Text = "Welcome, " + user.UserName + "!";
                UserLink.NavigateUrl = "/members/myaccountinfo.aspx";
            }
            if (Page.User.Identity.IsAuthenticated)
                RegisterLI.Visible = false;

        }
    }
}
